﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MM.Common.Base;
using MM.Common.DBBase;
using DevExpress.XtraEditors;

namespace MM.Common.Setup
{
    public partial class FrmSetupWithSelect : FrmSetupCommon
    {
        protected object mainCode;
        public FrmSetupWithSelect()
        {
            InitializeComponent();
        }

        protected override void freshData()
        {
            if (!this.selectFresh())
            {
                base.Close();
            }
        }
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            if ((this.mainCode == null) && !base.DesignMode)
            {
                base.Close();
            }
        }

        protected virtual bool RetrieveData(DataParamCol parm)
        {
            base.dtSetup.Rows.Clear();
            if (SystemInfo.DbData.Retrieve(base.sqlSetup, parm, ref this.dtSetup))
            {
                base.gvSetup.GridControl.DataSource = base.dtSetup;
                base.nbiSave.Visible = false;
                base.setCellEvent();
                return true;
            }
            XtraMessageBox.Show("取数据不成功！\r\n" + SystemInfo.DbData.ErrorMessage, "出错");
            base.Close();
            return false;
        }

        protected virtual bool selectFresh()
        {
            return true;
        }

    }
}
